<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="app">{{name|upperCase|capitalize}}</div>
		<script type="text/javascript">
			//全局过滤器
			Vue.filter('capitalize', function(value) {
				if (!value) return ''
				value = value.toString()
				return value.charAt(0).toLowerCase() + value.slice(1)
			})
			const vm1 = new Vue({
				el: '#app',
				data: {
					name: 'zhangsan'
				},
				filters: { //局部过滤器
					upperCase: function(val) {
						return val.toUpperCase();
					}
				}
			});
			/* const vm2 = new Vue({
				el: '#app2',
				data: {
					name: 'zhangsan'
				},
				filters: { //局部过滤器
					upperCase: function(val) {
						return val.toUpperCase();
					}
				}
			}) */
		</script>
	</body>
</html>
